package com.sp.properties;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * 传统的方法
 * 读取mysql.properties的配置信息
 */
public class Properties01 {
    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader("chapter19_IO\\src\\mysql.properties"));
        String line = "";
        while ((line = bufferedReader.readLine()) != null) {
            String[] split = line.split("=");
            //获取ip值
            if ("ip".equals(split[0])) {
                System.out.println(split[0] + "值是: " + split[1]);
            }
            System.out.println(line);
            if ("user".equals(split[0])){
                System.out.println(split[0] + "值是: " + split[1]);
            }
            if ("pwd".equals(split[0])){
                System.out.println(split[0] + "值是: " + split[1]);
            }
        }
        bufferedReader.close();
    }
}
